<template>
	<view class="page">
		<view class="bar_info" :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class="title_bar">
				<view class="title_bar_left" @tap.stop="handleJump" data-type="BACK">
					<image class="title_bar_left_icon" :src='STATIC_URL+"5.png"'></image>
				</view>
				<view class="title_bar_center">
					<text v-if="type == 1">用户协议</text>
					<text v-if="type == 2">隐私政策</text>
					<text v-if="type == 3">使用说明</text>
				</view>
				<view class="title_bar_right"></view>
			</view>
		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		
		<view class="loading_css" v-if="isShow">
			<u-loading size="36" color="#41AF36"></u-loading>
			<view class="loading_text">加载中</view>
		</view>
		
		<block v-else>
			<view class="content_info">
				<u-parse :html="content"></u-parse>
			</view>
		</block>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isShow: true,
				type: '1',  // 2隐私政策  1用户协议
				content: ""
			}
		},
		onLoad(options) {
			let { type } = options;
			if (type !== undefined) this.type = type;
			this.getData();
		},
		methods: {
			getData() {
				this.$api.get(global.apiUrls.getAgrement, {
					type: this.type
				}).then(res => {
					console.log(res);
					this.isShow = false;
					if (res.data.code == 200) {
						this.content = res.data.data.content;
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		.bar_info {
			width: 750rpx;
			height: 88rpx;
			overflow: hidden;
			border-bottom: 1px solid #eee;
			background: #fff;
			z-index: 10;
			position: fixed;
			top: 0rpx;
		
			.title_bar {
				padding: 0 32rpx;
				display: flex;
				justify-content: space-between;
		
				.title_bar_left {
					width: 50rpx;
					display: flex;
					align-items: center;
					.title_bar_left_icon {
						width: 18rpx;
						height: 32rpx;
					}
				}
		
				.title_bar_center {
					line-height: 88rpx;
					font-size: 36rpx;
					font-weight: 400;
				}
		
				.title_bar_right {
					width: 50rpx;
				}
			}
		}
		.content_info {
			padding: 32rpx;
			font-size: 26rpx;
			color: #666;
			line-height: 48rpx;
		}
	}
</style>